Vue.js in Action by Erik Hanchett & Benjamin Listwon

Vue.js in Action by Erik Hanchett & Benjamin Listwon

Author:Erik Hanchett & Benjamin Listwon
Language: eng
Format: mobi, epub
Publisher: Manning Publications
Published: 2018-09-25T17:25:07.905000+00:00


},

filters: {

...

},

created: function() {

axios.get('/static/products.json') 2

.then((response) =>{

this.products=response.data.products;

console.log(this.products);

});

}

}

</script>

1 Imports MyHeader into project

2 JSON products file is located in the static folder with the absolute path.

After copying the file, delete the styles and logo.png <img> tag in the App.vue file. If you like, you can also delete the logo.png file in the assets folder. Make sure to restart the Vue-CLI server by running npm run dev, if you haven’t already. You should see the pet store application launch, where you can navigate to the checkout page by clicking the Checkout button (figure 7.7). If you receive any errors, double-check the console. For example, if you forgot to import the Axios library inside index.html as we did in listing 7.9, you’ll get an error.

Figure 7.7. Pet store application opened with Vue-CLI.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.